package com.company.cloud.user.modules.api.fallback;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.user.modules.api.models.UserModel;
import com.company.cloud.user.modules.api.request.UserMgrUpdateParam;
import com.company.cloud.user.modules.api.request.UserPtQuery4PageParam;
import com.company.cloud.user.modules.api.request.UserRegisterParam;
import com.company.cloud.user.modules.api.service.UserPlatformRemoteService;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

import java.util.List;

@Log4j2
@Component
public class UserPlatformRemoteServiceFallbackFactory implements FallbackFactory<UserPlatformRemoteService> {
    @Override
    public UserPlatformRemoteService create(Throwable cause) {
        return new UserPlatformRemoteService() {
            @Override
            public BaseClientResult<String> saveUser(UserRegisterParam params) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<String> updateUser(UserMgrUpdateParam params) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<List<UserModel>> queryUsers(UserPtQuery4PageParam params) {
                return BaseClientResult.callbackError();
            }

            /**
             * 用户列表查询
             *
             * @param params
             */
            @Override
            public BaseClientResult queryUser(UserPtQuery4PageParam params) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<UserModel> getUser(Integer id) {
                return BaseClientResult.callbackError();
            }
        };
    }
}
